#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int m, n;
	cin >> m >> n;
	while (m--) {
		int x, mx = -1;
		for (int i = 1; i <= n; i++) {
			cin >> x;
			mx = max(mx, x);
		}
		cout << mx << " ";
	}
	return 0;
}
